﻿using MediatR;
using T_vehicle.Domain;
using T_vehicle.Infrastructure.Interfacec;
using T_vehicle.Read.API.Application.Command.AccidentCommand;

namespace T_vehicle.Read.API.Application.CommandHandlers.AccidentCommandHandlers
{
    public class FanAccidentCommandHandlers:IRequestHandler<FanAccidentCommand,Accident>
    {
        private readonly IAccidentRepository accidentRepository;

        public FanAccidentCommandHandlers(IAccidentRepository accidentRepository)
        {
            this.accidentRepository = accidentRepository;
        }

        public async Task<Accident> Handle(FanAccidentCommand request, CancellationToken cancellationToken)
        {
            var list = accidentRepository.GetModelAsync(request.AccidentId);  
            return await list;
        }
    }
}
